-- floor_status
-- created by zhuangsl
-- 下楼获得状态

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 下楼触发
    trigger = function(who, prop, arg)
        -- 持续时间,配置为99时认为是持续本层
        local round = CombatM.getRound() + prop[3];
        if prop[3] == 99 then
            round = -1;
        end

        -- TODO: 状态参数
        local condition = {
            ["end_round"] = round,
        };

        -- 附加状态
        CombatStatusM.applyStatus(who, prop[2], condition);
    end,

    desc = function(prop)
        local row = PropM.getRow(prop[1]);
        local desc = row.desc;

        -- 持续时间
        if prop[3] == 99 then
            -- 如果是持续本层
            desc = row.append_desc;
        else
            desc = string.gsub(desc, "{2}", prop[3]);
        end

        -- 状态名称
        local status = prop[2];
        local statsId = CombatStatusM.getStatusId(status);
        local statusName = CombatStatusM.query(statsId, "name");
        desc = string.gsub(desc, "{0}", statusName);

        return desc;
    end,

    record = function(target, prop, path)
        return false;
    end
};